//
//  FPLoginViewController.m
//  ForestPack
//
//  Created by jimmy on 2018/7/3.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "FPLoginViewController.h"
#import "UIView+Utils.h"
#import "FPThirdView.h"
#import "HMSegmentedControl.h"
#import "FPPesonRegisViewController.h"
#import "FPForgetSecretViewController.h"
#import "FPRegisterViewController.h"
#import "BaseTabBarViewController.h"

@interface FPLoginViewController ()<UIScrollViewDelegate,UITextFieldDelegate>

@property (nonatomic,strong)  UIButton            * loginButton;
@property (nonatomic,strong)  UIButton            * registerButton;
@property (nonatomic,strong)  HMSegmentedControl  * segControl;
@property (nonatomic,strong)  UIImageView         * topImageView;
@property (nonatomic,strong)  UIScrollView        * centerScroll;
@property (nonatomic,strong)  UIButton            * forgetSecret;

@property (nonatomic,strong)  UITextField         * phoneNumLogin;
@property (nonatomic,strong)  UITextField         * phoneNumRegis;
@property (nonatomic,strong)  UITextField         * passwordNum;
@property (nonatomic,strong)  UITextField         * verticodeNum;

@property (nonatomic,strong) NSTimer   *verCodeTimer;//验证码计时器
@property (nonatomic,assign) NSInteger verCodeTime;
@property (nonatomic,strong) UIButton  *verCodeBtn;//发送验证码按钮
@property (nonatomic,assign) BOOL      isMsgLogin;//是否短信登陆

@property (nonatomic,assign) BOOL      isNotRegiste;//是否是没注册过的

@end

@implementation FPLoginViewController


- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBarHidden = YES;
    
}


-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    self.navigationController.navigationBarHidden = NO;
    [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = nil;
}

- (UIImage *)createImageWithColor:(UIColor *)color {
    CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;
}


- (void)viewDidLoad
{
    [super viewDidLoad];
    _isMsgLogin = NO;
    _isNotRegiste = NO;
    
    [self setTopViewUI];
    [self setCenterViewUI];
    [self setBottomViewUI];
    
}

-(void)backClick
{
    kKeyWindow.rootViewController = [[BaseTabBarViewController alloc] init];
}

-(void)RegisterClick
{
    FPRegisterViewController *regisVC = [[FPRegisterViewController alloc] init];
    [self.navigationController pushViewController:regisVC animated:true];
}

-(void)LoginClick
{
    if (!_isMsgLogin) {
        if ([self.phoneNumLogin.text isEqualToString:@""] || [self.passwordNum.text isEqualToString:@""]) {
            [HttpManager showNoteMsg:@"请填写完整的信息"];
        }else{
            [self getData];
        }
    }else{
        if ([self.phoneNumRegis.text isEqualToString:@""] || [self.verticodeNum.text isEqualToString:@""]) {
            [HttpManager showNoteMsg:@"请填写完整的信息"];
        }else{
            [self getData];
        }
    }
    
}

-(void)getData
{
    NSString *url = @"";
    NSString *phone = @"";
    kNSUDefaultSaveVauleAndKey(@"120.038016", @"longitude");
    kNSUDefaultSaveVauleAndKey(@"30.250560", @"latitude");
    NSDictionary *parameter = @{};
    if (_isMsgLogin) {//短信登录
        url = [NSString stringWithFormat:@"%@app/login_message",REQUESTHEADER];
        UITextField *phoneField = [self.view viewWithTag:200];
        phone = phoneField.text;
        UITextField *codeField = [self.view viewWithTag:201];
        
        if (phoneField.text.length != 11 ) {//&& ![FPLoginAndRegisterTools isValidateMobile:phoneField.text]
            [HttpManager showNoteMsg:@"输入手机号码有误"];
            return;
        }
        if (![FPLoginAndRegisterTools checkYzmField:codeField.text]) {
            [HttpManager showNoteMsg:@"输入验证码有误"];
            return;
        }
        parameter = @{@"mobile":phoneField.text,@"code":codeField.text,@"longitude":kNSUDefaultReadKey(@"longitude"),@"latitude":kNSUDefaultReadKey(@"latitude")};
    }else {//用户密码登录
        url = [NSString stringWithFormat:@"%@app/login",REQUESTHEADER];
        UITextField *phoneField = [self.view viewWithTag:100];
        phone = phoneField.text;
        UITextField *passwordField = [self.view viewWithTag:102];
        if (phoneField.text.length != 11) {
            [HttpManager showNoteMsg:@"手机号格式错误"];
            return;
        }
        if (![FPLoginAndRegisterTools checkPassword:passwordField.text]){
            [HttpManager showNoteMsg:@"密码格式不对，请输入6-16位字母或数字的密码"];
            return;
        }
        parameter = @{@"mobile":phoneField.text,@"password":passwordField.text,@"longitude":kNSUDefaultReadKey(@"longitude"),@"latitude":kNSUDefaultReadKey(@"latitude")};
    }
    
    [HttpManager postHttpRequestByPost:url andParameter:parameter success:^(id successResponse) {
        NSString *status = [NSString stringWithFormat:@"%@",successResponse[@"status"]];
        if ([status isEqualToString:@"1"]) {
            kNSUDefaultSaveVauleAndKey(successResponse[@"token"], @"token");
            kNSUDefaultSaveVauleAndKey(phone, @"phone");
            kKeyWindow.rootViewController = [[BaseTabBarViewController alloc] init];
        }else {
            [HttpManager showNoteMsg:[NSString stringWithFormat:@"%@",successResponse[@"msg"]]];
        }
    } andFailure:^(id failureResponse) {
        [HttpManager showFail];
    }];
}

-(void)forgetSecretClick
{
    FPForgetSecretViewController *forgetVC = [[FPForgetSecretViewController alloc] init];
    [self.navigationController pushViewController:forgetVC animated:true];
}

-(void)vertifyData
{
    UITextField *phoneField = [self.view viewWithTag:200];
    if ([phoneField.text isEqualToString:@""] || phoneField.text.length != 11) {
        [HttpManager showNoteMsg:@"手机号格式错误"];
        return;
    }
    
    [HttpManager postHttpRequestByPost:[NSString stringWithFormat:@"%@app/mobile_send_code",REQUESTHEADER] andParameter:@{@"mobile":phoneField.text,@"type":@"3"} success:^(id successResponse) {
        NSString *status = [NSString stringWithFormat:@"%@",successResponse[@"status"]];
        if ([status isEqualToString:@"1"]) {
            [HttpManager showNoteMsg:[NSString stringWithFormat:@"%@",successResponse[@"msg"]]];
            
            self.verCodeTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerCountAction) userInfo:nil repeats:YES];
            self.verCodeTime = 60;
            [self.verCodeTimer fire];
            self.verCodeBtn.backgroundColor = UIColorFromRGB(@"#d1d0d0", 1);
            self.verCodeBtn.enabled = NO;
        }else {
            [HttpManager showNoteMsg:[NSString stringWithFormat:@"%@",successResponse[@"msg"]]];
        }
    } andFailure:^(id failureResponse) {
        [HttpManager showFail];
    }];
}


- (void)getVerifyCode
{
    UITextField *phoneField = [self.view viewWithTag:200];
    if ([phoneField.text isEqualToString:@""] || phoneField.text.length != 11) {
        [HttpManager showNoteMsg:@"手机号格式错误"];
        return;
    }
    WeakObj(self);
    NSString *url = @"";
    NSDictionary *parameter = @{};
    url = [NSString stringWithFormat:@"%@app/mobile",REQUESTHEADER];//先验证一下手机号是否可以注册，可以的话，再能发送验证码
    parameter = @{@"mobile":phoneField.text};
    [HttpManager postHttpRequestByPost:url andParameter:parameter success:^(id successResponse) {
        NSString *status = [NSString stringWithFormat:@"%@",successResponse[@"status"]];
        if ([status isEqualToString:@"1"]) {
            [HttpManager showNoteMsg:@"请注册后再登录"];
            selfWeak.isNotRegiste = YES;
            selfWeak.verCodeBtn.enabled = NO;
            return ;
            
        }else {
            [HttpManager showNoteMsg:[NSString stringWithFormat:@"%@",successResponse[@"msg"]]];
        }
    }andFailure:^(id failureResponse) {
        [HttpManager showFail];
    }];
    
    if (_isNotRegiste) {
        [self vertifyData];
    }else{
        return;
        
    }

    


}

- (void)timerCountAction{
    self.verCodeTime--;
    
    self.verCodeBtn.enabled = NO;
    [self.verCodeBtn setTitle:[NSString stringWithFormat:@"%ld秒后重发",(long)self.verCodeTime] forState:UIControlStateNormal];
    if (self.verCodeTime == 0) {
        self.verCodeTime = 60;
        self.verCodeBtn.backgroundColor = ThemeColor;
        self.verCodeBtn.enabled = YES;
        [self.verCodeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
        [self.verCodeTimer invalidate];
        self.verCodeTimer = nil;
    }
}

#pragma mark - 设置选项卡的点击事件
-(void)segmentDidChangedValue
{
    if (self.segControl.selectedSegmentIndex == 0) {
        _isMsgLogin = NO;
        [self.centerScroll setContentOffset:CGPointMake(0, 0) animated:YES];
        if (self.forgetSecret) {
            self.forgetSecret.hidden = NO;
        }
    }else{
        _isMsgLogin = YES;
        [self.centerScroll setContentOffset:CGPointMake(SCREEN_WIDTH, 0) animated:YES];
        if (self.forgetSecret) {
            self.forgetSecret.hidden = YES;
        }
    }
}

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    [self.loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
}

#pragma mark - touches
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    if (![self.phoneNumLogin isExclusiveTouch] || ![self.passwordNum isExclusiveTouch] || ![self.phoneNumRegis isExclusiveTouch]) {
        if ([self.phoneNumLogin isFirstResponder]) {
            [self.phoneNumLogin resignFirstResponder];
        }
        if ([self.phoneNumRegis isFirstResponder]) {
            [self.phoneNumRegis resignFirstResponder];
        }
        if ([self.passwordNum isFirstResponder]) {
            [self.passwordNum resignFirstResponder];
        }
    }
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

-(void)setTopViewUI
{
    UIButton *leftButton = [[UIButton alloc] initWithFrame:CGRectMake(ScreenX375(13), APP_STATUSBAR_HEIGHT, ScreenX375(22), ScreenX375(22))];
    [leftButton setImage:[UIImage imageNamed:@"返回红色"] forState:UIControlStateNormal];
    [leftButton addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:leftButton];
    
    self.topImageView = [[UIImageView alloc] init];
    self.topImageView.centerX = self.view.centerX;
    self.topImageView.size = CGSizeMake(ScreenX375(80), ScreenX375(80));
    self.topImageView.left = (SCREEN_WIDTH - ScreenX375(80)) / 2;
    self.topImageView.top = NAVIGATION_BAR_HEIGHT + ScreenX375(10);
    self.topImageView.image = [UIImage imageNamed:@"组11"];
    [self.view addSubview:self.topImageView];
    
    self.registerButton = [[UIButton alloc] init];
    self.registerButton.frame = CGRectMake(SCREEN_WIDTH - ScreenX375(80), NAVIGATION_BAR_HEIGHT + ScreenX375(5), ScreenX375(65), ScreenX375(30));
    self.registerButton.layer.masksToBounds = true;
    self.registerButton.layer.cornerRadius = 15;
    self.registerButton.layer.borderWidth = 0.5;
    self.registerButton.layer.borderColor = RGB_COLOR(237, 34, 59).CGColor;
    [self.registerButton setTitle:@"注册" forState:UIControlStateNormal];
    [self.registerButton addTarget:self action:@selector(RegisterClick) forControlEvents:UIControlEventTouchUpInside];
    self.registerButton.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.registerButton setTitleColor:RGB_COLOR(237, 34, 59) forState:UIControlStateNormal];
    [self.view addSubview:self.registerButton];
    
}

-(void)setCenterViewUI
{
    //这里要自己加segmentView并且可以左右滑动
    self.segControl = [[HMSegmentedControl alloc] initWithSectionTitles:@[@"手机号登录",@"短信登录"]];
    self.segControl.frame = CGRectMake(ScreenX375(70), self.topImageView.bottom + ScreenX375(45), SCREEN_WIDTH - ScreenX375(140), ScreenX375(44));
    self.segControl.backgroundColor = [UIColor clearColor];
    self.segControl.selectionStyle = HMSegmentedControlSelectionStyleTextWidthStripe;
    self.segControl.autoresizingMask = UIViewAutoresizingFlexibleWidth |  UIViewAutoresizingFlexibleRightMargin;
    self.segControl.titleTextAttributes = @{NSForegroundColorAttributeName:RGB_COLOR(153, 153, 153),NSFontAttributeName:[UIFont fontWithName:@"PingFangSC-Regular" size:18]};
    //设置选项卡被选中的颜色
    self.segControl.selectedTitleTextAttributes = @{NSForegroundColorAttributeName:RGB_COLOR(237, 34, 59),NSFontAttributeName:[UIFont fontWithName:@"PingFangSC-Regular" size:18]};
    self.segControl.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown;
    
    self.segControl.selectionIndicatorHeight = 2;
    self.segControl.selectionIndicatorColor = RGB_COLOR(237, 34, 59);
    //设置开始时默认选中的下标
    self.segControl.selectedSegmentIndex = 0;
    //设置选中的选项卡的点击事件
    [self.segControl addTarget:self action:@selector(segmentDidChangedValue) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:self.segControl];
    
    self.centerScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, self.segControl.bottom + ScreenX375(5), SCREEN_WIDTH, ScreenX375(138))];
//    self.centerScroll.pagingEnabled = YES;
    self.centerScroll.scrollEnabled = NO;
    self.centerScroll.showsVerticalScrollIndicator = NO;
    self.centerScroll.showsHorizontalScrollIndicator = NO;
    self.centerScroll.delegate = self;
    [self.centerScroll setContentSize:CGSizeMake(SCREEN_WIDTH * 2, 0)];
    [self.view addSubview:self.centerScroll];
    [self setScrollViewLeft];
    [self setScrollViewRight];
    
    self.loginButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.loginButton.backgroundColor = RGB_COLOR(237, 34, 59);
    self.loginButton.frame = CGRectMake(ScreenX375(40), SCREEN_HEIGHT - ScreenX375(186) - ScreenX375(44), SCREEN_WIDTH - ScreenX375(80), ScreenX375(44));
    self.loginButton.layer.masksToBounds = true;
    self.loginButton.layer.cornerRadius = 22;
    [self.loginButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [self.loginButton setTitle:@"登录" forState:UIControlStateNormal];
    [self.loginButton addTarget:self action:@selector(LoginClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.loginButton];
    
    self.forgetSecret = [UIButton buttonWithType:UIButtonTypeCustom];
    self.forgetSecret.frame = CGRectMake(SCREEN_WIDTH - ScreenX375(40) - ScreenX375(75), self.loginButton.top - ScreenX375(30), ScreenX375(85), ScreenX375(20));
    self.forgetSecret.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.forgetSecret setImage:[UIImage imageNamed:@"找回密码"] forState:UIControlStateNormal];
    [self.forgetSecret setTitle:@"找回密码" forState:UIControlStateNormal];
    [self.forgetSecret setTitleColor:RGB_COLOR(153, 153, 153) forState:UIControlStateNormal];
    self.forgetSecret.backgroundColor = [UIColor whiteColor];
    [self.forgetSecret addTarget:self action:@selector(forgetSecretClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.forgetSecret];
}

-(void)setScrollViewLeft
{
    UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScreenX375(118))];
    leftView.tag = 2001;
    [self.centerScroll addSubview:leftView];
    UIImageView *nameIamge = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(40), ScreenX375(31), ScreenX375(14), ScreenX375(23))];
    nameIamge.image = [UIImage imageNamed:@"手机号"];
    [leftView addSubview:nameIamge];
    
    self.phoneNumLogin = [[UITextField alloc] initWithFrame:CGRectMake(nameIamge.right+ScreenX375(10), ScreenX375(31), SCREEN_WIDTH - ScreenX375(104), ScreenX375(20))];
    self.phoneNumLogin.delegate = self;
    self.phoneNumLogin.placeholder = @"请输入您注册的手机号";
    self.phoneNumLogin.secureTextEntry = NO;
    self.phoneNumLogin.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.phoneNumLogin.textColor = UIColorFromRGB(@"504848", 1);
    self.phoneNumLogin.keyboardType = UIKeyboardTypePhonePad;
    self.phoneNumLogin.tag = 100;
//    [self.phoneNumLogin addTarget:self action:@selector(textFieldDidBeginEditing:) forControlEvents:UIControlEventEditingChanged];
    [leftView addSubview:self.phoneNumLogin];
    
    UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(40, self.phoneNumLogin.bottom + ScreenX375(15), SCREEN_WIDTH - ScreenX375(80), 1)];
    line1.backgroundColor = RGBACOLOR(238, 238, 238, 1);
    [leftView addSubview:line1];
    
    UIImageView *numIamge = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(40), line1.bottom + ScreenX375(31), ScreenX375(14), ScreenX375(23))];
    numIamge.image = [UIImage imageNamed:@"密码"];
    [leftView addSubview:numIamge];
    
    self.passwordNum = [[UITextField alloc] initWithFrame:CGRectMake(nameIamge.right+ScreenX375(10), line1.bottom + ScreenX375(31), SCREEN_WIDTH - ScreenX375(104), ScreenX375(20))];
    self.passwordNum.delegate = self;
    self.passwordNum.placeholder = @"请输入您的登录密码";
    self.passwordNum.secureTextEntry = YES;
    self.passwordNum.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.passwordNum.textColor = UIColorFromRGB(@"504848", 1);
    self.passwordNum.tag = 102;
    [leftView addSubview:self.passwordNum];
    
    UIView *line2 = [[UIView alloc] initWithFrame:CGRectMake(ScreenX375(40), self.passwordNum.bottom + ScreenX375(16), SCREEN_WIDTH - ScreenX375(80), 1)];
    line2.backgroundColor = RGBACOLOR(238, 238, 238, 1);
    [leftView addSubview:line2];
    
    
    
}
-(void)setScrollViewRight
{
    UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH, 0, SCREEN_WIDTH, 118)];
    rightView.tag = 2002;
    [self.centerScroll addSubview:rightView];
    UIImageView *nameIamge = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(40), ScreenX375(31), ScreenX375(14), ScreenX375(23))];
    nameIamge.image = [UIImage imageNamed:@"手机号"];
    [rightView addSubview:nameIamge];
    
    self.phoneNumRegis = [[UITextField alloc] initWithFrame:CGRectMake(nameIamge.right+ScreenX375(10), ScreenX375(31), SCREEN_WIDTH - ScreenX375(104), ScreenX375(20))];
    self.phoneNumRegis.placeholder = @"请输入您注册的手机号";
    self.phoneNumRegis.delegate = self;
    self.phoneNumRegis.secureTextEntry = NO;
    self.phoneNumRegis.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.phoneNumRegis.textColor = UIColorFromRGB(@"504848", 1);
    self.phoneNumRegis.keyboardType = UIKeyboardTypePhonePad;
    self.phoneNumRegis.tag = 200;
    [rightView addSubview:self.phoneNumRegis];
    
    UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(ScreenX375(40), self.phoneNumRegis.bottom + ScreenX375(15), SCREEN_WIDTH - ScreenX375(80), 1)];
    line1.backgroundColor = RGBACOLOR(238, 238, 238, 1);
    [rightView addSubview:line1];
    
    UIImageView *numIamge = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(40), line1.bottom + ScreenX375(31), ScreenX375(14), ScreenX375(23))];
    numIamge.image = [UIImage imageNamed:@"验证码"];
    [rightView addSubview:numIamge];
    
    self.verticodeNum = [[UITextField alloc] initWithFrame:CGRectMake(nameIamge.right+ScreenX375(10), line1.bottom + ScreenX375(31), SCREEN_WIDTH - ScreenX375(190), ScreenX375(20))];
    self.verticodeNum.delegate = self;
    self.verticodeNum.placeholder = @"请输入您的验证码";
    self.verticodeNum.secureTextEntry = NO;
    self.verticodeNum.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.verticodeNum.keyboardType = UIKeyboardTypePhonePad;
    self.verticodeNum.textColor = UIColorFromRGB(@"504848", 1);
    self.verticodeNum.tag = 201;
    [rightView addSubview:self.verticodeNum];
    
    self.verCodeBtn = [[UIButton alloc] init];
    self.verCodeBtn.frame = CGRectMake(SCREEN_WIDTH - ScreenX375(40) - ScreenX375(84), line1.bottom + ScreenX375(30), ScreenX375(84), ScreenX375(26));
    self.verCodeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    self.verCodeBtn.layer.cornerRadius = 13;
    self.verCodeBtn.layer.masksToBounds = YES;
    self.verCodeBtn.backgroundColor = ThemeColor;
    [self.verCodeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
    [self.verCodeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.verCodeBtn addTarget:self action:@selector(getVerifyCode) forControlEvents:UIControlEventTouchUpInside];
    [rightView addSubview:self.verCodeBtn];
    
    UIView *line2 = [[UIView alloc] initWithFrame:CGRectMake(ScreenX375(40), self.verticodeNum.bottom + ScreenX375(15), SCREEN_WIDTH - ScreenX375(80), 1)];
    line2.backgroundColor = RGBACOLOR(238, 238, 238, 1);
    [rightView addSubview:line2];
    
}

#pragma mark - 设置尾部三方登录View
-(void)setBottomViewUI
{
    FPThirdView *thirdView = [[FPThirdView alloc] init];
    thirdView.frame = CGRectMake(0, SCREEN_HEIGHT - ScreenX375(120), SCREEN_WIDTH, ScreenX375(120));
    [self.view addSubview:thirdView];
    
    
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:true];
}


@end
